package com.zhiqianbao.shared;

import android.content.Context;
import android.content.SharedPreferences;

import com.zhiqianbao.constants.Constants;

/**
 * @ClassName: SharedPreferanceUtils
 * @Description: TODO 该类用于操作SharedPreferance
 * @author 刘子龙
 * @date 2017-4-17 下午2:31:56
 */
public class SharedPreferanceUtils {

	private static volatile SharedPreferences sharedPreferences = null;
	private static volatile SharedPreferences.Editor editor = null;
	private int openCount = 0;
	private String shared_preferences_flag = null;
	private static final String SHARED_ISJUMPTO_TARGET_ACTIVITY = "SHARED_ISJUMPTO_TARGET_ACTIVITY";
	private static final String SHARED_DATA_LOGIN_FLAG = "SHARED_DATA_LOGIN_FLAG";
	private static final String SHARED_DATA_FINISH_FLAG = "SHARED_DATA_FINISH_FLAG";
	private static final String SHARED_JOB = "SHARED_DJOB";
	// --------------------------shared文件标识--------------------------------------------------------------------------------
	private static final String SHARED_LOCAL_NAME = "SHARED_LOCAL_NAME";
    private static final String NOANNOUNCEMENT_COUNTS="NoAnnouncementCounts";
	private static final String USER_JOB_PROFESSION="user_job_profession";
	/**
	 * 构造方法
	 * 
	 * @param shared_preferences_flag
	 * @param context
	 */
	public SharedPreferanceUtils(String shared_preferences_flag, Context context) {
		this(context);
		this.shared_preferences_flag = shared_preferences_flag;
		if (context != null) {
			sharedPreferences = context.getSharedPreferences(Constants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
			editor = sharedPreferences.edit();
		}
	}

	/**
	 * 构造方法
	 * 
	 * @param context
	 */
	public SharedPreferanceUtils(Context context) {
		if (context != null) {
			sharedPreferences = context.getSharedPreferences(Constants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
			editor = sharedPreferences.edit();
		}
	}

	/**
	 * 初始化工具
	 */
	public static void initSharedData(Context context) {
		if (sharedPreferences == null) {
			synchronized (SharedPreferanceUtils.class) {
				if (sharedPreferences == null)
					sharedPreferences = context.getSharedPreferences(SHARED_LOCAL_NAME, Context.MODE_PRIVATE);
				if (editor == null)
					editor = sharedPreferences.edit();
			}
		}
	}

	/**
	 * 保存数据
	 *
	 * @param isJump
	 *            是否跳转标识
	 * @param loginFlag
	 *            登录标识
	 * @param finishFlag
	 *            结束标识
	 * @author Wall
	 */
	public static void setJumpInfo(boolean isJump, int loginFlag, int finishFlag) {
		synchronized (editor) {
			editor.putBoolean(SHARED_ISJUMPTO_TARGET_ACTIVITY, isJump);
			editor.putInt(SHARED_DATA_LOGIN_FLAG, loginFlag);
			editor.putInt(SHARED_DATA_FINISH_FLAG, finishFlag);
			editor.commit();
		}
	}

	public static boolean getIsJumpFlag() {
		synchronized (sharedPreferences) {
			return sharedPreferences.getBoolean(SHARED_ISJUMPTO_TARGET_ACTIVITY, false);
		}
	}


	public static int getLoginFlag() {
		synchronized (sharedPreferences) {
			return sharedPreferences.getInt(SHARED_DATA_LOGIN_FLAG, -1);
		}
	}

	public static int getFinishFlag() {
		synchronized (sharedPreferences) {
			return sharedPreferences.getInt(SHARED_DATA_FINISH_FLAG, -1);
		}
	}

	/**
	 * 获取未读公告数目
	 * @return
     */
	public int getNoAnnouncementCounts(){
		return  sharedPreferences.getInt(NOANNOUNCEMENT_COUNTS,0);
	}

	/**
	 * 添加未读公告数
	 * @param counts
     */
	public void setNoannouncementCounts(int counts){
		editor.putInt(NOANNOUNCEMENT_COUNTS,counts);
		editor.commit();
	}
	/**
	 * 获得打开的次数
	 * 
	 * @return
	 */
	public int getActivityOpenCount() {
		openCount = sharedPreferences.getInt(shared_preferences_flag, 0);
		return openCount;
	}

	/**
	 * 用于清空界面打开次数数据
	 */
	public void clearActivityOpenCount() {
		for (int i = 0; i < Constants.SHARED_PREFERENCE_ACTIVITYS.length; i++) {
			editor.putInt(Constants.SHARED_PREFERENCE_ACTIVITYS[i], 0);
			editor.commit();
		}
	}

	/**
	 * 用于从SharedPreferance中获取程序版本
	 * 
	 * @return
	 */
	public String getAppVersion() {
		return sharedPreferences.getString(Constants.SHARED_PREFERENCE_APP_VERSION, "");
	}

	/**
	 * 用于设置SharedPreferance中的程序版本
	 */
	public void setAppVersion(String version) {
		editor.putString(Constants.SHARED_PREFERENCE_APP_VERSION, version);
		editor.commit();
	}

	/**
	 * 保存工作信息
	 * @param job
	 */
	public static void setJob(String job){
		editor.putString(Constants.SHARED_JOB,job);
		editor.commit();
	}
	public static String getJob(){
		return sharedPreferences.getString(Constants.SHARED_JOB,"");
	}

	/**
	 *
	 * 保存身份证状态是否通过
	 * @param
	 */
	public static void setidCardState(String idCardState){
		editor.putString(Constants.SHARED_IDCARD,idCardState);
		editor.commit();
	}
	public static String getidCardState(){
		return sharedPreferences.getString(Constants.SHARED_IDCARD,"");
	}

	/**
	 * 芝麻认证
	 * @param zhiMaState
	 */
	public static void setZhiMaState(String zhiMaState){
		editor.putString(Constants.SHARED_ZHIMA,zhiMaState);
		editor.commit();
	}
	public static String getZhiMaState(){
		return sharedPreferences.getString(Constants.SHARED_ZHIMA,"");
	}

	/**
	 * 工作信息，所属行业
	 * @param profession
	 */
	public void setUserJobProfession(String profession){
		editor.putString(USER_JOB_PROFESSION,profession);
		editor.commit();
	}
	public  String getUserJobProfession(){
		return sharedPreferences.getString(USER_JOB_PROFESSION,"");
	}
	/**
	 * 芝麻开关
	 * @param zhimaOpenOrClose
	 */
	public static void setZhimaOpenOrClose(String zhimaOpenOrClose){
		editor.putString(Constants.SHARED_ZHIMAOPEN,zhimaOpenOrClose);
		editor.commit();
	}

	public static String getZhimaOpenOrClose(){
		return sharedPreferences.getString(Constants.SHARED_ZHIMAOPEN,"");
	}

	/**
	 * 连连状态
	 * @param lianlianPayStatus
	 */
	public static void setLianlianPayStatus(String lianlianPayStatus){
		editor.putString(Constants.SHARED_LIANLIAN,lianlianPayStatus);
		editor.commit();
	}

	public static String getLianlianPayStatus(){
		return sharedPreferences.getString(Constants.SHARED_LIANLIAN,"");
	}

	/**
	 * 融宝状态
	 * @param rongbaoPayStatus
	 */
	public static void setRongbaoPayStatus(String rongbaoPayStatus){
		editor.putString(Constants.SHARED_RONGBAOPAYSTATE,rongbaoPayStatus);
		editor.commit();
	}

	public static String getRongbaoPayStatus(){
		return sharedPreferences.getString(Constants.SHARED_RONGBAOPAYSTATE,"");
	}

	/**
	 * 支付宝状态
	 * @param aliPayStatus
	 */
	public static void setAliPayStatus(String aliPayStatus){
		editor.putString(Constants.SHARED_ALIPAYSTATE,aliPayStatus);
		editor.commit();
	}

	public static String getAliPayStatus(){
		return sharedPreferences.getString(Constants.SHARED_ALIPAYSTATE,"");
	}

	/**
	 * 银行卡号
	 * @param idCard
	 */
	public static void setidCard(String idCard){
		editor.putString(Constants.SHARED_ID,idCard);
		editor.commit();
	}

	public static  String getidCard(){
		return sharedPreferences.getString(Constants.SHARED_ID,"");
	}

	/**
	 * 用户名
	 * @param name
	 */
	public static void setName(String name){
		editor.putString(Constants.SHARED_NAME,name);
		editor.commit();
	}
	public static String getName(){
		return sharedPreferences.getString(Constants.SHARED_NAME,"");
	}
	/**
	 * 保存上次期数
	 * @param data
	 */
	public static void setData(Integer data){
		editor.putInt(Constants.SHARED_DAYA,data);
		editor.commit();
	}
	public static int getData(){
		return sharedPreferences.getInt(Constants.SHARED_DATA,Integer.parseInt(""));
	}

	/**
	 * 保存上次的钱
	 * @param money
	 */
	public static void setMoney(Integer money){
		editor.putInt(Constants.SHARED_MONEY,money);
		editor.commit();
	}

	public static  int getMoney(){
		return sharedPreferences.getInt(Constants.SHARED_MONEY,Integer.parseInt(""));
	}
	/**
	 * 保存运营商
	 * @param telecon
	 */
	public static void setTelecon(String telecon){
		editor.putString(Constants.SHARED_TELECON,telecon);
		editor.commit();
	}
	public static String getTelecon(){
		return sharedPreferences.getString(Constants.SHARED_TELECON,"");
	}

	/**
	 * 淘宝
	 * @param taoBao
	 */
	public static void setTaoBao(String taoBao){
		editor.putString(Constants.SHARED_TAOBAO,taoBao);
		editor.commit();
	}
	public  static String getTaoBao(){
		return sharedPreferences.getString(Constants.SHARED_TAOBAO,"");
	}

	/**
	 * 紧急联系人
	 * @param emergency
	 */
	public static void seteEmergency(String emergency){
		editor.putString(Constants.SHARED_EMEGENCY,emergency);
		editor.commit();
	}
	public static String getEmergency(){
		return sharedPreferences.getString(Constants.SHARED_EMEGENCY,"");
	}

	/**
	 * 工作信息
	 * @param jobState
	 */
	public static void setJobState(String jobState){
		editor.putString(Constants.SHARED_STATTE,jobState);
		editor.commit();
	}
	public static  String getJobState(){
		return  sharedPreferences.getString(Constants.SHARED_STATTE,"");
	}
	/**
	 * 保存是否强制升级
	 * @param
	 */

	public static void setForce(String foce){
		editor.putString(Constants.SHARED_FORCE,foce);
		editor.commit();
	}

	public static  String getForce(){
		return sharedPreferences.getString(Constants.SHARED_FORCE,"");
	}

	/**
	 * 保存是否升级code标识
	 * @param codeMs
	 */
	public static void setCodeMs(String codeMs){
		editor.putString(Constants.SHARED_CODEMS,codeMs);
		editor.commit();
	}
	public static String getCodeMs(){
		return sharedPreferences.getString(Constants.SHARED_CODEMS,"");
	}

	/**
	 * 登录时的token
	 * @param token
	 */
	public static void setToken(String token){
		try {
			editor.putString(Constants.SHARED_TOKEN,token);
			editor.commit();
		}catch (Exception e){

		}

	}
	public static String getToken() {
		return sharedPreferences.getString(Constants.SHARED_TOKEN, "");

	}

	public static void setUserId(String id){
		editor.putString(Constants.SHARED_UserID,id);
		editor.commit();
	}

	public static void date(){
        editor.clear().commit();
    }
	public static String getUserId(){
		return sharedPreferences.getString(Constants.SHARED_UserID,"");
	}
	public void setSid(String sid){
		editor.putString(Constants.SHARED_SID,sid);
		editor.commit();
	}
	public String getSid(){
		return sharedPreferences.getString(Constants.SHARED_SID,"");
	}


	public void setAppData(String data){
		editor.putString(Constants.SHARED_DATA,data);
		editor.commit();
	}
	public String getAppData(){
		return  sharedPreferences.getString(Constants.SHARED_DATA,"");
	}

    /**
     * 公司地址
     * @param adress
     */
	public void setAdress(String adress){
        editor.putString(Constants.SHARED_ADRESS,adress);
        editor.commit();
    }
    public String getAdress(){
        return sharedPreferences.getString(Constants.SHARED_ADRESS,"");
    }

	/**
	 * 保存工作信息账号
	 * @param jobNumber
	 */
	public void setJobNumber(String jobNumber){
		editor.putString(Constants.SHARED_NUMBER,jobNumber);
		editor.commit();
	}
	public  String getJobNumber(){
		return sharedPreferences.getString(Constants.SHARED_NUMBER,"");
	}

	/**
	 * 省的内容
	 * @param province
	 */
	public void setProvince(String province){
		editor.putString(Constants.SHARED_PROVINCE,province);
		editor.commit();
	}
	public String getProvince(){
		return sharedPreferences.getString(Constants.SHARED_PROVINCE,"");
	}

	/**
	 * 工作信息区域
	 * @param area1
	 */
	public void setArea1(String area1){
		editor.putString(Constants.SHARED_AREA,area1);
		editor.commit();
	}
	public String getArea1(){
		return sharedPreferences.getString(Constants.SHARED_AREA,"");
	}

	/**
	 * 工作信息中的城市
	 */
	public void setCity12(String ciyi1){
		editor.putString(Constants.SHARED_CITY1,ciyi1);
		editor.commit();
	}
	public String getCity12(){
		return sharedPreferences.getString(Constants.SHARED_CITY1,"");
	}
    /**
     * 电话号码
     * @param phoneNuber
     */
    public void setPhoneNuber(String phoneNuber){
        editor.putString(Constants.SHARED_PHONE_NUMEBR,phoneNuber);
        editor.commit();
    }
    public String getPhoneNuber(){
        return sharedPreferences.getString(Constants.SHARED_PHONE_NUMEBR,"");
    }


    /**
     * 区号
     * @param areaCode
     */
    public void setAreaCode(String areaCode){
        editor.putString(Constants.SHARED_AREDCODE,areaCode);
        editor.commit();
    }
    public String getAreaCode(){
        return sharedPreferences.getString(Constants.SHARED_AREDCODE,"");
    }
	/**
	 * 银行
	 * @param banckName
	 */
	public void setBanckName(String banckName){
		editor.putString(Constants.SHARED_BANCNAME,banckName);
		editor.commit();
	}
	public String getBanckName(){
		return sharedPreferences.getString(Constants.SHARED_BANCNAME,"");
	}

	/**
	 * 保存是否自动登录状态
	 *
	 * @param auto
	 */
	public static void setAuto(boolean auto) {
		editor.putBoolean(Constants.SHARED_AUTO, auto);
		editor.commit();
	}

	public static boolean getAuto() {
		return sharedPreferences.getBoolean(Constants.SHARED_AUTO, false);
	}


	/**
	 * 保存服务器的web地址
	 *
	 * @param url
	 */
	public  void setWebAdress(String url) {
		editor.putString(Constants.SHARED_WEB_ADRESS, url);
		editor.commit();
	}

	public  String getWebAdress() {
		return sharedPreferences.getString(Constants.SHARED_WEB_ADRESS, "");
	}

	/**
	 * 保存服务器api地址
	 *
	 * @param url
	 */
	public void setApiAdress(String url) {
		editor.putString(Constants.SHARED_API_ADRESS, url);
		editor.commit();
	}

	public  String getApiAdress() {
		return sharedPreferences.getString(Constants.SHARED_API_ADRESS, "");
	}


	public  static void setClear(){
		editor.clear();
		editor.commit();
	}
	/**
	 * 打开的次数加1
	 * 
	 * @param count
	 */
	public void addActivityOpenCount(int count) {
		editor.putInt(shared_preferences_flag, count);
		editor.commit();
	}

	/**
	 * 保存用户登录的手机号
	 * 
	 * @param telNum
	 * @author 张岩
	 * @date 2013-9-26 上午8:16:50
	 */
	public void setTelNum(String telNum) {
		editor.putString(Constants.SHARED_PERFERENCE_TEL_NUM, telNum);
		editor.commit();
	}

	public void setCardNod(String cardNod) {
		editor.putString(Constants.SHARED_PERFERENCE_CARD_NO, cardNod);
		editor.commit();
	}

	public void setBank(String Bank) {
		editor.putString(Constants.SHARED_PERFERENCE_Bank, Bank);
		editor.commit();
	}

	/**
	 * 保存银行卡号
	 * @param bank
	 */
	public void setBacnNumber(String bank){
		editor.putString(Constants.SHARED_BANCK,bank);
		editor.commit();
	}

	public void setBoolean(Boolean  sss){
		editor.putBoolean(Constants.SHARRD_TRUE,true);
		editor.commit();
	}

	public Boolean getBoolean(){
		return sharedPreferences.getBoolean(Constants.SHARRD_TRUE,true);
	}
	/**
	 * 城市
	 * @param city
	 */
	public void setCity(String city){
		editor.putString(Constants.SHARED_CITY,city);
		editor.commit();
	}
	public String getCity(){
		return sharedPreferences.getString(Constants.SHARED_CITY,"");
	}

	/**
	 * 添加联系人adapter里面的关系
	 */
	public void setAdapterRelation(String relation){
		editor.putString(Constants.SHARED_ADAPTER_RALATION,relation);
		editor.commit();
	}
	public String getAdapterRelation(){
		return 	sharedPreferences.getString(Constants.SHARED_ADAPTER_RALATION,"");
	}
	/**
	 * 第二个关系
	 * @param city
	 */
	public void setRelation(String city){
		editor.putString(Constants.SHARED_RALTION,city);
		editor.commit();
	}
	public String getRelation(){
		return sharedPreferences.getString(Constants.SHARED_RALTION,"");
	}


	/**
	 * 父亲
	 * @param father
	 */
	public void setFather(String father){
		editor.putString(Constants.SHARED_FATHER,father);
		editor.commit();
	}
	public String getFather(){
		return sharedPreferences.getString(Constants.SHARED_FATHER,"");
	}

	/**
	 * 配偶
	 * @param po
	 */
	public void setPo(String po){
		editor.putString(Constants.SHARED_PO,po);
		editor.commit();
	}
	public String getPo(){
		return sharedPreferences.getString(Constants.SHARED_PO,"");
	}
	/**
	 * 连连签约结果
	 * @param resultO
	 */

	public void setResultO(String resultO){
		editor.putString(Constants.SHARED_LIANLIAN_RESULT,resultO);
		editor.commit();
	}
	public String getResultO(){
		return sharedPreferences.getString(Constants.SHARED_LIANLIAN_RESULT,"");
	}
	/**
	 * 銀行卡號
	 * @param cardNuber
	 */
	public void setBanckCardNuber(String cardNuber){
		editor.putString(Constants.SHARED_BANCK_NUMBER,cardNuber);
		editor.commit();
	}

	public String getBanckCardNuber(){
		return sharedPreferences.getString(Constants.SHARED_BANCK_NUMBER,"");
	}
    /**
     * 单位名称
     * @param companey
     */
	public void setCompaney(String companey){
        editor.putString(Constants.SHARED_COMPANEY,companey);
        editor.commit();
    }
    public String getCompaney(){
        return sharedPreferences.getString(Constants.SHARED_COMPANEY,"");
    }
	/**
	 * 取出
	 * @return
	 */
	public String getBacnNumber(){
		return sharedPreferences.getString(Constants.SHARED_BANCK,"");
	}


	public void setVertf(String Vertf) {
		editor.putString(Constants.SHARED_PERFERENCE_VERTIFY, Vertf);
		editor.commit();
	}

	public String getVertf() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_VERTIFY, "");
	}

	/**
	 * 获取上次登录时保存的手机号
	 * 
	 * @return
	 * @author 张岩
	 * @date 2013-9-26 上午8:18:49
	 */
	public String getTelNum() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_TEL_NUM, "");
	}

	public String getCardNod() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_CARD_NO, "");
	}

	/**
	 * @Title: setRememberToken
	 * @Description: TODO 存储rememberToken
	 * @author 张岩
	 * @param @param
	 *            remembertoken
	 * @return void
	 * @throws @date
	 *             2014-4-23 下午9:16:23
	 */
	public void setRememberToken(String remembertoken) {
		editor.putString(Constants.SHARED_PERFERENCE_REMEMBER_TOKEN, remembertoken);
		editor.commit();
	}

	/**
	 * @Title: getRememberToken
	 * @Description: TODO 获得rememberToken
	 * @author 张岩
	 * @param @return
	 * @return String
	 * @throws @date
	 *             2014-4-23 下午9:16:26
	 */
	public String getRememberToken() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_REMEMBER_TOKEN, "");
	}

	/**
	 * @Title: setHasNewVersion
	 * @Description: TODO 初始化的时候设置hasnewversion
	 * @author 张岩
	 * @param @param
	 *            hasnewversion
	 * @return void
	 * @throws @date
	 *             2014-10-27 下午5:25:05
	 */
	public void setHasNewVersion(String hasnewversion) {
		editor.putString(Constants.SHARED_PERFERENCE_HASNEWVERSION, hasnewversion);
		editor.commit();
	}

	/**
	 *
	 * @param phone
	 */
	public void setPhone(String phone){
		editor.putString(Constants.SHARED_PHONE,phone);
		editor.commit();
	}
	public  String getPhone(){
		return sharedPreferences.getString(Constants.SHARED_PHONE,"");
	}

	/**
	 * 保存用户名
	 * @param userName
	 */
	public void setUserName(String userName){
		editor.putString(Constants.SAVE_USERNAME,userName);
		editor.commit();
	}



	public String getUserName(){
		return  sharedPreferences.getString(Constants.SAVE_USERNAME,"");
	}


	/**
	 * 保存是否登陆过状态
	 * @param b
	 */
	public void setState(Boolean b){
		editor.putBoolean(Constants.SAVE_SATTE,b);
		editor.commit();
	}
	public boolean getState(){
		return sharedPreferences.getBoolean(Constants.SAVE_SATTE, Boolean.parseBoolean(""));
	}

	/**
	 * 保存密码
	 * @param password
	 */
	public  void setPassword(String password){
		editor.putString(Constants.SAVE_PASSWORD,password);
		editor.commit();
	}
	public  String getPassword(){
		return sharedPreferences.getString(Constants.SAVE_PASSWORD,"");
	}

	/**
	 * @Title: getHasNewVersion
	 * @Description: TODO 获取hasNewVersion
	 * @author 张岩
	 * @param
	 * @return void
	 * @throws @date
	 *             2014-10-27 下午5:41:56
	 */
	public String getHasNewVersion() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_HASNEWVERSION, "0");
	}

	/**
	 * @Title: setSaveKeyAndValues
	 * @Description: TODO
	 * @author 张岩
	 * @param @param
	 *            key
	 * @param @param
	 *            values
	 * @return void
	 * @throws @date
	 *             2015-4-8 下午3:37:12
	 */
	public void setId(String id) {
		editor.putString(Constants.SHARED_PERFERENCE_TEL_NUM, id);
		editor.commit();
	}


	/**
	 * 获取上次登录时保存的手机号
	 * 
	 * @return
	 * @author 张岩
	 * @date 2013-9-26 上午8:18:49
	 */
	public String getId() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_TEL_NUM, "");
	}

	/**
	 * 保存身份證號
	 * @param idCard
	 */
	public void setIdCard(String idCard){
		editor.putString(Constants.SHARED_IDCARD_NUMBER,idCard);
		editor.commit();
	}

	public String getIdCard(){
		return sharedPreferences.getString(Constants.SHARED_IDCARD_NUMBER,"");
	}

	/**
	 * 银行卡id
	 * 
	 * @param key
	 * @param values
	 */
	public void setSaveKeyAndValues(String key, String values) {

		editor.putString(key, values);
		editor.commit();
	}

	/**
	 * @Title: getSaveKeyAndValues
	 * @Description: TODO
	 * @author 张岩
	 * @param @param
	 *            key
	 * @param @return
	 * @return String
	 * @throws @date
	 *             2015-4-8 下午3:49:24
	 */
	public String getSaveKeyAndValues(String key) {
		return sharedPreferences.getString(key, "0");
	}

	/**
	 * @Title: setGesturePassWord
	 * @Description: TODO 保存手势密码
	 * @author 张培森
	 * @param @param
	 *            strGesturePassWord
	 * @return void
	 * @throws @date
	 *             2015-4-10 下午12:58:53
	 */
	public void setGesturePassWord(String strGesturePassWord) {

		editor.putString(Constants.SHARED_PERFERENCE_GESTUREPASSWORD, strGesturePassWord);
		editor.commit();
	}

	/**
	 * @Title: getGesturePassWord
	 * @Description: TODO 获取手势密码
	 * @author 张培森
	 * @param @return
	 * @return String
	 * @throws @date
	 *             2015-4-10 下午1:00:31
	 */
	public String getGesturePassWord() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_GESTUREPASSWORD, "");
	}

	/**
	 * @Title: setSwitchStatus
	 * @Description: TODO 保存手势状态值
	 * @author 张培森
	 * @param @param
	 *            switchStatus
	 * @return void
	 * @throws @date
	 *             2015-4-10 下午1:48:19
	 */
	public void setSwitchStatus(boolean switchStatus) {

		editor.putBoolean(Constants.SHARED_PERFERENCE_GESTURESWITCH, switchStatus);
		editor.commit();
	}

	/**
	 * @Title: getSwitchStatus
	 * @Description: TODO 获取手势状态值
	 * @author 张培森
	 * @param @return
	 * @return String
	 * @throws @date
	 *             2015-4-10 下午1:49:02
	 */
	public boolean getSwitchStatus() {
		return sharedPreferences.getBoolean(Constants.SHARED_PERFERENCE_GESTURESWITCH, false);
	}

	/**
	 * @Title: setIsforeground
	 * @Description: TODO 设置前台activity状态值
	 * @author 张培森
	 * @param @param
	 *            isforeground
	 * @return void
	 * @throws @date
	 *             2015-4-15 下午3:01:07
	 */
	public void setIsforeground(boolean isforeground) {

		editor.putBoolean(Constants.SHARED_PERFERENCE_GESTURESWITCH, isforeground);
		editor.commit();
	}

	/**
	 * @Title: getIsforeground
	 * @Description: TODO 获取前台activity状态值
	 * @author 张培森
	 * @param @return
	 * @return boolean
	 * @throws @date
	 *             2015-4-15 下午3:01:11
	 */
	public boolean getIsforeground() {
		return sharedPreferences.getBoolean(Constants.SHARED_PERFERENCE_GESTURESWITCH, false);
	}



	/**
	 * @Title: getUserInfo
	 * @Description: TODO 获取用户信息
	 * @author 张岩
	 * @param @return
	 * @return UserInfo
	 * @throws @date
	 *             2015-4-17 下午2:43:21

	/**
	 * @Title: setIsFirstGesture @Description: TODO 初始设置手势密码后,只打开手势密码开关状态
	 *         ,不跳转验证手势密码页面 @param @param isFirstGesture @return void @throws
	 */
	public void setIsFirstGesture(String isFirstGesture) {

		editor.putString(Constants.SHARED_PERFERENCE_ISFIRSTGESTURE, isFirstGesture);
		editor.commit();
	}

	/**
	 * @Title: getIsFirstGesture @Description: TODO 初始设置手势密码后,只打开手势密码开关状态
	 *         ,不跳转验证手势密码页面 @param @return @return String @throws
	 */
	public String getIsFirstGesture() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_ISFIRSTGESTURE, "");
	}

	/**
	 * @Title: setMaxid @Description: TODO 设置最大值 @param @param isMaxid @return
	 *         void @throws
	 */
	public void setMaxid(String isMaxid) {
		editor.putString(Constants.SHARED_PERFERENCE_ISMAXID, isMaxid);
		editor.commit();
	}

	/**
	 * @Title: getMaxid @Description: TODO 获取最大值 @param @return @return
	 *         String @throws
	 */
	public String getMaxid() {
		return sharedPreferences.getString(Constants.SHARED_PERFERENCE_ISMAXID, "");
	}

	/**
	 * 保存屏幕尺寸信息<br>
	 * 因为存在使用中切换到桌面再回来导致保存的常量回复初始值的情况出现
	 * 
	 * @param height
	 * @param width
	 * @author Wall
	 */
	public void setScreenSize(int height, int width) {
		editor.putInt(Constants.SHARED_PREFERENCE_SCREEN_HEIGHT, height);
		editor.putInt(Constants.SHARED_PREFERENCE_SCREEN_WIDTH, width);
		editor.commit();
	}

	/**
	 * 获取屏幕尺寸信息 item1:高度,item2:宽度
	 * 
	 * @return
	 * @author Wall
	 */
	public int[] getScreenSize() {
		return new int[] { sharedPreferences.getInt(Constants.SHARED_PREFERENCE_SCREEN_HEIGHT, 0), sharedPreferences.getInt(Constants.SHARED_PREFERENCE_SCREEN_WIDTH, 0) };
	}
	// public void setImgsopt(JSONArray imgsoptJSONArray) {
	// editor.putStringSet(Constants.SHARED_PERFERENCE_VERTIFY,
	// imgsoptJSONArray);
	// editor.commit();
	// }

	/**
	 * 保存银行卡列表提示对话框
	 * 
	 * @param msg
	 *            内容
	 * @param version
	 *            版本
	 * @author Wall
	 */
	public void setBankListTips(String msg, String version) {
		editor.putString(Constants.SHARED_BANKLIST_MESSAGE, msg);
		editor.putString(Constants.SHARED_BANKLIST_VERSION, version);
		editor.commit();
	}

	/**
	 * 为了不频繁显示换卡提示，只有当应用版本或提示信息发生变化的时候提醒一次，提醒过后保存新的数据到shared中，这样当前版本中就不会再次提示了
	 * 
	 * @param msg
	 * @param version
	 * @return
	 * @author Wall
	 */
	public boolean isNeedShowBankListTips(String msg, String version) {
		String save_msg = sharedPreferences.getString(Constants.SHARED_BANKLIST_MESSAGE, "");
		String save_version = sharedPreferences.getString(Constants.SHARED_BANKLIST_VERSION, "");
		return !save_msg.equals(msg) || !save_version.equals(version);
	}

	public void setRongbaoPayStatus() {

	}
}
